package org.argus.job.common.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * Job Server Instance
 * @Author 刘文/Cliff Liu
 * @Date 2024/11/21
 */
@Data
@EqualsAndHashCode
@AllArgsConstructor
@NoArgsConstructor
public class JobServerInstance {
    private String ip;

    private int port;

    public static JobServerInstance of(String serverInfo) {
        String[] serverInfoArr = serverInfo.split(":");
        return new JobServerInstance(serverInfoArr[0], Integer.parseInt(serverInfoArr[1]));
    }

    @Override
    public String toString() {
        return ip + ":" + port;
    }
}
